package com.wbq501.common.base

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.ViewModel

abstract class BaseActivity<VM : ViewModel, DB : ViewDataBinding> : AppCompatActivity() {

    lateinit var mViewModel: VM
    lateinit var mDatabind: DB

    var dataBindView : View? = null
    abstract fun layoutId(): Int
    abstract fun initView()
    abstract fun initData()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mDatabind = DataBindingUtil.setContentView(this,layoutId())
        mDatabind.lifecycleOwner = this
        initView()
        initData()
    }

}